<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>出入库信息管理</title>
<meta name="decorator" content="default" />
<style type="text/css">		
	#contentTable td ,#contentTable th{
		text-align: center;
	}
	.minWidth {
		min-width: 177px;
	}	
</style>
<script type="text/javascript">
    top.$.jBox.tip.mess=0;
	$(document).ready(function() {
		$("#all").click(function() {
			if (this.checked) {
				$("#check :checkbox").prop("checked", true);
			} else {
				$("#check :checkbox").prop("checked", false);
			}
		});
		
		$("#btnDown").click(function() {
			layer.confirm('确认要导出历史出入库订单数据吗？', {
				btn : [ '确认', '取消' ]
			}, function() {
				$("#searchForm").attr("action", "${ctx}/order/bsVaccineOrderHL/exportExcel");
				$("#searchForm").submit();
				layer.msg('正在导出，请等待...', {icon: 1});
				$("#searchForm").attr("action", "${ctx}/order/bsVaccineOrderHL/allList?type=1");
				setTimeout(function(){
					layer.closeAll();
				},5000);
			}, function() {
				
			});
		});
		
		$("#searchForm").validate({
			submitHandler: function(form){
				form.submit();
				var index = layer.load(2, {shade: [0.5, '#000']});
			},
			ignore: ":hidden",
			errorContainer: "#messageBox",
			errorPlacement: function(error, element) {
				$("#messageBox").text("输入有误，请先更正。");
				if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
					error.appendTo(element.parent().parent());
				} else {
					error.insertAfter(element);
				}
			}
		});
	});
	function page(n, s) {
		$("#pageNo").val(n);
		$("#pageSize").val(s);
		$("#searchForm").submit();
		return false;
	}

	function selectAll() {
		if ($("[name=selectAll]").is(':checked')) {
			var checks = $("[name=check]:checkbox").attr("checked", true);
			var str = "";
			for (var i = 0; i < checks.length; i++) {
				str += "id=" + checks[i].value + "&";
			}
			str = str.substring(0, str.length - 1);
		} else {
			$("[name=check]:checkbox").attr("checked", false);
		}
		if (str.length != 0) {
			return str;
		}
	}

	var bsVaccineOrder = JSON.parse('${fns:toJson(bsVaccineOrder)}');
	function finishVaccine2Company() {
		if (bsVaccineOrder && bsVaccineOrder["vaccineId"]) {
			$("#vaccineId").val(bsVaccineOrder.vaccineId);
			$("#vaccineId").select2();
		}
	}

	function rese() {//重置
		$("#orderType").val("").select2();
		$("#vaccineId").val("");
		$("#startDate").val("");
		$("#endDate").val("");
		$("#batchno").val("");
		$("#orderNo").val("");
	}
</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a>历史出入库信息列表</a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="bsVaccineOrder" action="${ctx}/order/bsVaccineOrderHL/allList?type=1" method="post"
		class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}" />
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}" />
		<table class="table table-bordered">
			<tr>
				<th>出入库类型：</th>
				<td>
					<form:select path="orderType" id="orderType" class="span2 minWidth">
						<form:option value="" label="--请选择--" />
						<form:options items="${fns:getDictList('hl_inout_type')}"
							itemLabel="label" itemValue="value" htmlEscape="false" />
					</form:select>
				</td>
			    <th>疫苗批号：</th>
				<td>
				    <form:input type="text" path="batchno" id="batchno" class="input-medium" value="${bsVaccineOrder.batchno}"/>
				</td>
				<th>出入库单号：</th>
				<td><input type="text" name="orderNo" id="orderNo" class="input-medium" value="${bsVaccineOrder.orderNo}"/></td>
				
			</tr>
			<tr>
				<th>出入库开始日期:</th>
				<td><input name="startDate" id="startDate" type="text"
					readonly="readonly" maxlength="20" class="input-medium Wdate"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"
					value='<fmt:formatDate value='${bsVaccineOrder.startDate}' pattern="yyyy-MM-dd" />' />
				</td>
				<th>出入库截至日期:</th>
				<td colspan="3"><input name="endDate" id="endDate" type="text"
					readonly="readonly" maxlength="20" class="input-medium Wdate"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"
					value='<fmt:formatDate value='${bsVaccineOrder.endDate}' pattern="yyyy-MM-dd" />' />
				</td>
			</tr>
		</table>

		<div>
			<button id="btnSubmit" class="btn btn-primary" type="submit" >查询</button>
			<button id="btnReset" class="btn btn-primary" type="button" onclick = "rese()">重置</button>
			<button id="btnDown" class="btn btn-primary" type="button" >导出</button>
		</div>
	</form:form>
	<sys:message content="${message}" />
	<table id="contentTable"
		class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>编号</th>
				<th>操作</th>
				<th>类型</th>
				<th>订单号</th>
				<th>订单状态</th>
				<th>出入库日期</th>
				<th>供货单位</th>
				<th>收货单位</th>
				<th>录入单位</th>
			</tr>
		</thead>
		<tbody id="check">
			<c:forEach items="${page.list}" var="bsVaccineOrder" begin="0" varStatus="status">
				<tr>
					<td>${(page.pageNo-1)*page.pageSize+status.index+1 }</td>
					<%-- <td>${bsVaccineOrder.id}</td> --%>
					<td><a href="${ctx}/order/bsVaccineOrderHL/veiwHLForm?id=${bsVaccineOrder.id}">查看</a>
					<td>${fns:getDictLabel(bsVaccineOrder.orderType, "hl_inout_type", "")}
					</td>
					<td>${bsVaccineOrder.orderNo}</td>
					<td>${fns:getDictLabel(bsVaccineOrder.orderStatus, "hl_order_status", "")}
					</td>
					<td><fmt:formatDate value="${bsVaccineOrder.outboundDate}" pattern="yyyy-MM-dd" /></td>
					<td>${bsVaccineOrder.supplyorgName}</td>
					<td>${bsVaccineOrder.receiveorgName}</td>
					<td>${bsVaccineOrder.createorgName}</td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>